/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.com.compassion.entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/** Clase entidad para el mapeo de tabla de base de datos Tiposalida
* @author grupo de Tesis
*/
@Entity
@Table(name = "tiposalida")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tiposalida.findAll", query = "SELECT t FROM Tiposalida t"),
    @NamedQuery(name = "Tiposalida.findByIdTipoSalida", query = "SELECT t FROM Tiposalida t WHERE t.idTipoSalida = :idTipoSalida"),
    @NamedQuery(name = "Tiposalida.findByNomTipoSalida", query = "SELECT t FROM Tiposalida t WHERE t.nomTipoSalida = :nomTipoSalida")})
public class Tiposalida implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idTipoSalida")
    private Integer idTipoSalida;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nomTipoSalida")
    private String nomTipoSalida;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoSalida")
    private Collection<Salida> salidaCollection;

    public Tiposalida() {
    }

    public Tiposalida(Integer idTipoSalida) {
        this.idTipoSalida = idTipoSalida;
    }

    public Tiposalida(Integer idTipoSalida, String nomTipoSalida) {
        this.idTipoSalida = idTipoSalida;
        this.nomTipoSalida = nomTipoSalida;
    }

    public Integer getIdTipoSalida() {
        return idTipoSalida;
    }

    public void setIdTipoSalida(Integer idTipoSalida) {
        this.idTipoSalida = idTipoSalida;
    }

    public String getNomTipoSalida() {
        return nomTipoSalida;
    }

    public void setNomTipoSalida(String nomTipoSalida) {
        this.nomTipoSalida = nomTipoSalida;
    }

    @XmlTransient
    public Collection<Salida> getSalidaCollection() {
        return salidaCollection;
    }

    public void setSalidaCollection(Collection<Salida> salidaCollection) {
        this.salidaCollection = salidaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoSalida != null ? idTipoSalida.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tiposalida)) {
            return false;
        }
        Tiposalida other = (Tiposalida) object;
        if ((this.idTipoSalida == null && other.idTipoSalida != null) || (this.idTipoSalida != null && !this.idTipoSalida.equals(other.idTipoSalida))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.com.compassion.entidades.Tiposalida[ idTipoSalida=" + idTipoSalida + " ]";
    }
    
}
